<template>
  <div class="container storelist">
    <ul class="list"
        v-if="store_arr.length>0">
      <li class="list-item"
          @tap.stop="to_shopdetail(item)"
          v-for="(item, index) in store_arr"
          :key="index">
        <div class="logo">
          <img :src="imgUrl+item.shop_logo"
               v-if="imgUrl"
               alt=""
               class="img">
        </div>

        <div class="info">
          <div class="store-title clearfix">
            {{item.shop_name}}
            <div class="icons clearfix">
              <!-- 星 -->
              <!-- <img :src="img_baseurl+'/mp_3.0/tag_star@3x.png'"
                   v-if="img_baseurl"
                   alt=""
                   class="icon"> -->
              <!-- 保 -->
              <!-- <img :src="img_baseurl+'/mp_3.0/tag_safeguard@2x.png'"
                   v-if="img_baseurl"
                   alt=""
                   class="icon"> -->
            </div>
          </div>

          <div class="rate">
            <i-rate :value="item.grade"
                    size="16"
                    :i-class="'star'"
                    disabled>
              {{item.grade}}分
            </i-rate>
          </div>
          <div class="address">
            {{item.category_name}} {{item.city_name}} / {{item.district_name}}
            <div class="distance">
              <img :src="img_baseurl+'/mp_3.0/ic_location@3x.png'"
                   v-if="img_baseurl"
                   alt=""
                   class="icon">
              {{item.distance}}km
            </div>
          </div>
          <div class="section card"
               v-if="item.plus_info.plus_name&&item.plus_info.plus_name!=''">
            <div class="left">
              <img :src="img_baseurl+'/mp_3.0/tag_card@3x.png'"
                   v-if="img_baseurl"
                   alt=""
                   class="icon">
              {{item.plus_info.plus_name}}
            </div>
            <div class="right">
              已售{{item.plus_info.plus_sale_num}}
            </div>
          </div>
          <div class="section service"
               v-if="item.service_info.service_name&&item.service_info.service_name!=''">
            <div class="left">
              <img :src="img_baseurl+'/mp_3.0/tag_serve@3x.png'"
                   v-if="img_baseurl"
                   alt=""
                   class="icon">
              {{item.service_info.service_name}}
            </div>
            <div class="right">
              已售{{item.service_info.service_sale_num}}
            </div>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import common from '@/assets/js/mmk_common.js'
export default {
  data () {
    return {
      imgUrl: common.image_response,
      img_baseurl: common.image_resource,
    }
  },
  methods: {
    to_shopdetail (item) {
      let router = encodeURIComponent(`shop?id=${item.id}`)
      wx.navigateTo({ url: `/pages/life_beauty/main?router=${router}` });
    }
  },
  watch: {
    store_arr (newVal, oldVal) {
    }
  },
  props: ["store_arr"]

}
</script>


<style lang="less" scoped>
.container {
  padding-bottom: 60px;
  .list {
    width: 100%;
    .list-item {
      display: flex;
      padding: 15px;
      border-top: 1px solid #f0eded;
      .logo {
        width: 68px;
        height: 100%;
        .img {
          width: 68px;
          height: 68px;
          background-color: #ccc;
        }
      }
      .info {
        flex: 1;
        margin-left: 10px;
        .store-title {
          font-size: 14px;
          font-family: "PingFangSC-Medium", "PingFangSC";
          font-weight: 500;
          color: rgba(51, 51, 51, 1);
          line-height: 20px;
          .icons {
            float: right;
            .icon {
              width: 13px;
              height: 13px;
              display: inline-block;
              vertical-align: middle;
              margin-left: 6px;
            }
          }
        }
        .rate {
          height: 16px;
          position: relative;
          font-size: 12px;
          font-family: "PingFangSC-Regular", "PingFangSC";
          font-weight: 400;
          color: rgba(255, 130, 105, 1);
          margin-top: -6px;
        }
        .address {
          font-size: 12px;
          font-family: "PingFangSC-Regular", "PingFangSC";
          font-weight: 400;
          color: rgba(102, 102, 102, 1);
          line-height: 17px;
          margin-top: 13px;
          .distance {
            float: right;
            .icon {
              width: 11px;
              height: 12px;
              display: inline-block;
              vertical-align: middle;
            }
          }
        }
        .section {
          display: flex;
          margin-top: 5px;
          .left {
            flex: 1;
            font-size: 12px;
            font-family: "PingFangSC-Regular", "PingFangSC";
            font-weight: 400;
            color: rgba(51, 51, 51, 1);
            line-height: 16px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            vertical-align: middle;
            .icon {
              width: 13px;
              height: 13px;
              display: inline-block;
              vertical-align: middle;
            }
          }
          .right {
            font-size: 12px;
            font-family: "PingFangSC-Regular", "PingFangSC";
            font-weight: 400;
            color: rgba(153, 153, 153, 1);
            line-height: 16px;
          }
        }
      }
      &:first-of-type {
        border-top: none;
      }
    }
  }
}
</style>
